//Add data validation to this tic tac toe program //for "extra credit" (at most 5 points) //The data validation should make sure that the user //enters a move in the range 1-9 and the board //at the move index-1 is not already taken. #include using std::cin; using std::cout; using std::endl; void displayGameBoard(char board[]); void switchPlayer(char& currentPlayer); bool playerWon(char board[]); bool boardFull(char board[]); void main() { //array - list of variables //int A[10] ={1}; //size must be a literal or constant positive whole number //indices are in the range 0-9 //A[0] = 9; //cout<< A[0] << endl; //for(int i = 0; i < 5; i++) //{ // cin >> A[i]; //} //for(int i = 0; i < 10; i++) //{ // cout << A[i] << endl; //} //for(int i = 0; i < 256; i++) //{ // cout << i << "= " << (char)i << endl; //} char board[9] = {'1','2','3','4','5','6','7','8','9'}; char currentPlayer = 'X'; bool gameOver = false; while(!gameOver) { displayGameBoard(board); //good place for data validation loop cout << currentPlayer << "'s Turn> "; int move; cin >> move; board[move-1] = currentPlayer; switchPlayer(currentPlayer); if(playerWon(board)) { gameOver = true; } else if(boardFull(board)) { cout << "CAT WON" << endl; gameOver = true; } } displayGameBoard(board); } void displayGameBoard(char board[]) { cout << board[0] << "|" << board[1] << "|" << board[2] <